package net.pimpas.web.tests.context;
import java.util.Iterator;
import java.util.Locale;
import java.util.ResourceBundle;

import javax.faces.context.FacesContext;

import net.pimpas.core.context.FrameworkContext;
import net.pimpas.core.session.FrameworkSession;

public class FrameworkContextFacesImpl implements FrameworkContext {

	private static final long serialVersionUID = -6450684309543780062L;
	private Locale locale;
	private FrameworkSession session;
	
	public FrameworkContextFacesImpl() {
		this.setLocale(new Locale("en", "US"));
		this.setSession(new FacesSession());
	}

	public Locale getDefaultLocale() {
		return FacesContext.getCurrentInstance().getApplication().getDefaultLocale();
	}

	public ResourceBundle getDefaultResourceBundle() {
		return ResourceBundle.getBundle(FacesContext.getCurrentInstance().getApplication().getMessageBundle());
	}

	public ResourceBundle getResourceByName(String arg0) {
		return null;
	}

	public Iterator getSupportedLocales() {
		return FacesContext.getCurrentInstance().getApplication().getSupportedLocales();
	}

	public Locale getLocale() {
		return this.locale;
	}

	public void setLocale(Locale locale) {
		this.locale = locale;
	}

	public FrameworkSession getSession() {
		return this.session;
	}

	public void setSession(FrameworkSession session) {
		this.session = session;
	}
}